//
//  OrderViewController.m
//  PersonnelWashCar
//
//  Created by 张越 on 16/4/20.
//  Copyright © 2016年 张越. All rights reserved.
//

#import "OrderViewController.h"
#import "YSLContainerViewController.h"
#import "NoFinishOrderController.h"
#import "AlreadyFinishOrderController.h"

@interface OrderViewController ()<YSLContainerViewControllerDelegate>

@end

@implementation OrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NoFinishOrderController *sampleVC1 = [[NoFinishOrderController alloc]initWithNibName:@"NoFinishOrderController" bundle:nil];
    sampleVC1.title = @"待完成";
    
    AlreadyFinishOrderController *sampleVC2 = [[AlreadyFinishOrderController alloc]initWithNibName:@"AlreadyFinishOrderController" bundle:nil];
    sampleVC2.title = @"已完成";
    
    // ContainerView
    YSLContainerViewController *containerVC = [[YSLContainerViewController alloc]initWithControllers:@[sampleVC1,sampleVC2]
                                                                                        topBarHeight:0
                                                                                parentViewController:self];
    containerVC.delegate = self;
    containerVC.menuItemFont = [UIFont fontWithName:@"Futura-Medium" size:14];
    
    [self.view addSubview:containerVC.view];
}

-(void)viewDidAppear:(BOOL)animated{
    NSString *str = [[NSUserDefaults standardUserDefaults]objectForKey:@"ViewKey"];
    if([str isEqualToString:@"1"])
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"SelectTabRootView" object:nil];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"ViewKey"];
    }
}

#pragma mark -- YSLContainerViewControllerDelegate
- (void)containerViewItemIndex:(NSInteger)index currentController:(UIViewController *)controller
{
    [controller viewWillAppear:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
